#include "basic_integration.hpp"

void basic_integration::add_user(const std::string& u, const std::string& p)
{
    boost::unique_lock<boost::mutex> lock(m_usersSentinel);
    m_users.insert(KnownUsers::value_type(u, p));
}

int basic_integration::get_auth_methods() const
{
    return auth_user_passd;
}

bool basic_integration::verify_user_passwd(const std::string& user, const std::string& passwd)
{
    boost::unique_lock<boost::mutex> lock(m_usersSentinel);
    const bool valid = m_users.find(KnownUsers::value_type(user, passwd)) != m_users.end();
    std::cout << "user/passwd " << (valid ? "valid" : "invalid") << std::endl;
    return valid;
}

void basic_integration::set_pty_name(const std::string& name)
{
    std::cout << "terminal name: " << name << std::endl;
}

void basic_integration::set_pty_size(const pty_width& w, const pty_height& h, const pty_pxwidth& pxw, const pty_pxheight& pxh)
{
    std::cout << "terminal size: " << w.value << "x" << h.value << ", pixels: " << pxw.value << "x" << pxh.value << std::endl;
}

void basic_integration::set_env_var(const std::string& name, const std::string& value)
{
    std::cout << "env. variable name: '" << name << "', value: '" << value << "'" << std::endl;
}
